package cn.wk.libs4a.net;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import android.content.Context;
import cn.wk.libs4a.WKApplication;

public class _HttpRequest extends WKHttpRequest {

	public _HttpRequest(Context context) {
		super(context);
	}

	/**
	 * DEMO
	 */
	public String GetMerchantInfo(String posCode) {
		try {
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("posCode", posCode));
			params.add(new BasicNameValuePair("operator", app().sp
					.getString("operator")));// 添加操作员
			String url = WKApplication.BASE_URL + "GetMerchantInfo";
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 获取版本号
	 */
	public String get_version() {
		try {
			String url = WKApplication.BASE_URL + "get_version";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 商家类别列表 接口：store_type_list * 参数：city_name(城市ID)
	 */
	public String store_type_list(String city_name, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "store_type_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("city_name", city_name));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 获取商店列表 接口：store_list * 参数：city_id(城市ID,改成city_name), distance(距离，可选),
	 * type_youhui(优惠类型，可选), type_shanghu(商户类型，可选), start, count city_id,
	 * coordinate_x, coordinate_y, distance, type_youhui, type_shanghu, start,
	 * count, store_like
	 */
	public String store_list(String city_name, double coordinate_x,
			double coordinate_y, String distance, String type_youhui,
			String type_shanghu, int start, int count, String store_like,
			boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "store_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("city_name", city_name));
			params.add(new BasicNameValuePair("coordinate_x", coordinate_x + ""));
			params.add(new BasicNameValuePair("coordinate_y", coordinate_y + ""));
			params.add(new BasicNameValuePair("distance", distance));
			params.add(new BasicNameValuePair("type_youhui", type_youhui));
			params.add(new BasicNameValuePair("type_shanghu", type_shanghu));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));
			params.add(new BasicNameValuePair("store_like", store_like));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 首页和优惠页广告列表 接口：get_ad * 参数：city_name, ad_type(城市ID，广告类别：首页／优惠)
	 */
	public String get_ad(String city_name, String ad_type, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "get_ad";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("city_name", city_name));
			params.add(new BasicNameValuePair("ad_type", ad_type));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 商家详情 接口：store_info * 参数：store_id(商家ID)
	 */
	public String store_info(String token, String store_id, String user_id,
			double coordinate_x, double coordinate_y, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "store_info";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("store_id", store_id));
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("coordinate_x", String
					.valueOf(coordinate_x)));
			params.add(new BasicNameValuePair("coordinate_y", String
					.valueOf(coordinate_y)));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 商家关注 接口：store_attention * 参数：store_id(商家ID)
	 */
	public String store_attention(String token, String store_id, String user_id,
			boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "store_attention";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("store_id", store_id));
			params.add(new BasicNameValuePair("user_id", user_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 商家取消关注 接口：cancel_attention * 参数：store_id(商家ID)
	 */
	public String cancel_attention(String token, String store_id, String user_id,
			boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "cancel_attention";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("store_id", store_id));
			params.add(new BasicNameValuePair("user_id", user_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 商家点评列表 接口：store_comment_list * 参数：store_id, start, count(商家ID，起始，条数)
	 */
	public String store_comment_list(String store_id, int start, int count,
			int type, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "store_comment_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("store_id", store_id));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));
			params.add(new BasicNameValuePair("type", String.valueOf(type)));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 商家点评列表 接口：store_comment_list * 参数：store_id, user_id, star,
	 * content(暂时不加图片相关),
	 * servicelevel=""&circumstancelevel=""&creditlevel=""&avgconsumeamount
	 * =""&branchcode=""
	 */
	public String store_comment(String token, String store_id, String user_id, int star,
			String content, int servicelevel, int circumstancelevel,
			int creditlevel, double avaconsumeamount, String branchcode,
			boolean... readLoacal) {
		try {
			String url = WKApplication.BASE_URL + "store_comment";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("store_id", store_id));
			params.add(new BasicNameValuePair("user_id", user_id));
			// params.add(new BasicNameValuePair("time",
			// String.valueOf(count)));
			params.add(new BasicNameValuePair("star", String.valueOf(star)));
			params.add(new BasicNameValuePair("content", content));
			params.add(new BasicNameValuePair("servicelevel", String
					.valueOf(servicelevel))); // 默认为5
			params.add(new BasicNameValuePair("circumstancelevel", String
					.valueOf(circumstancelevel))); // 默认为5
			params.add(new BasicNameValuePair("creditlevel", String
					.valueOf(creditlevel))); // 默认为5
			params.add(new BasicNameValuePair("avgconsumeamount", String
					.valueOf(avaconsumeamount))); // 默认为0
			params.add(new BasicNameValuePair("branchcode", "")); // 服务器自动查找

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLoacal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 可兑换礼品列表 接口：gift_list * 参数：user_id, start, count,
	 * type(用户ID，起始，条数，类型：1热门，2最近)
	 */
	public String gift_list(String token, String user_id, int start, int count, String type,
			boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "gift_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));
			params.add(new BasicNameValuePair("type", type));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 礼品详细 接口：gift_info * 参数：gift_id(礼品ID)
	 */
	public String gift_info(String gift_id, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "gift_info";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("gift_id", gift_id));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}
	/**
	 * 获取生成的订单信息
	 */
	public String build_order(String token, String user_id,String gift_no,String gift_buy_num,String address_id){
		try {
			String url = WKApplication.BASE_URL+"SubmitOrder";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("gift_no", gift_no));
			params.add(new BasicNameValuePair("gift_buy_num", gift_buy_num));
			params.add(new BasicNameValuePair("address_id", address_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, false);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 兑换礼品操作 接口：gift_buy * 参数：user_id, gift_id(用户ID，礼品ID)
	 */
	public String gift_buy(String token, String user_id, String gift_id, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "gift_buy";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("gift_id", gift_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 登录 接口：login * 参数：name, password(用户名，密码) 修改——phone_number_login
	 */
	public String login(String name, String password) {
		try {
			String url = WKApplication.BASE_URL + "phone_number_login";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("name", name));
			params.add(new BasicNameValuePair("password", password));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 注册 接口：register * 参数：待定
	 */
	public String register() {
		try {
			String url = WKApplication.BASE_URL + "register";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			// params.add(new BasicNameValuePair("city_id", city_id));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 短信获取验证码 接口：request_code * 参数：phone
	 */
	public String request_code(String phone) {
		try {
			String url = WKApplication.BASE_URL + "request_code";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("phone", phone));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 找回密码 接口：update_psw * 参数：phone, code, password
	 */
	public String update_psw(String phone, String code, String password) {
		try {
			String url = WKApplication.BASE_URL + "reset_psw";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("phone", phone));
			params.add(new BasicNameValuePair("code", code));
			params.add(new BasicNameValuePair("password", password));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 用户信息 接口：user_info * 参数：user_id
	 */
	public String user_info(String token, String user_id, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "user_info";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 我的消息列表 接口：my_msg_list * 参数：user_id, start, count
	 */
	public String my_msg_list(String token, String user_id, int start, int count,
			boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "my_msg_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 读取消息 接口：read_message * 参数：msg_id
	 */
	public String read_message(String token, String msg_id, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "read_message";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("msg_id", msg_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 银行卡列表 接口：my_card_list * 参数：user_id, start, count
	 */
	public String my_card_list(String token, String user_id, int start, int count,
			boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "my_card_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 绑定银行卡 接口：my_card_bind * 参数：user_id, number, user_name
	 */
	public String my_card_bind(String token, String user_id, String number, String user_name) {
		try {
			String url = WKApplication.BASE_URL + "my_card_bind";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("number", number));
			params.add(new BasicNameValuePair("user_name", user_name));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 我的点评列表 接口：my_shop_comment_list * 参数：user_id, start, count
	 */
	public String my_shop_comment_list(String token, String user_id, int start, int count,
			String store_id, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "my_shop_comment_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));
			params.add(new BasicNameValuePair("store_id", store_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 删除点评 接口：my_store_comment_del * 参数：user_id, comment_id
	 */
	public String my_store_comment_del(String token, String user_id, String comment_id) {
		try {
			String url = WKApplication.BASE_URL + "my_store_comment_del";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("comment_id", comment_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 我的点评列表 接口：my_comment_list * 参数：user_id, start, count
	 */
	public String my_comment_list(String token, String user_id, int start, int count,
			boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "my_comment_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 删除点评 接口：my_comment_del * 参数：user_id, comment_id
	 */
	public String my_comment_del(String token, String user_id, int comment_id) {
		try {
			String url = WKApplication.BASE_URL + "my_comment_del";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("comment_id", String
					.valueOf(comment_id)));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 我的店铺列表 接口：my_store_list * 参数：user_id, start, count
	 */
	public String my_store_list(String token, String user_id, double coordinate_x,
			double coordinate_y, int start, int count, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "my_store_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("coordinate_x", coordinate_x + ""));
			params.add(new BasicNameValuePair("coordinate_y", coordinate_y + ""));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 我的地址列表 接口：my_address_list * 参数：user_id, start, count
	 */
	public String my_address_list(String token, String user_id, int start, int count,
			boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "my_address_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 新增地址 接口：my_address_add * 参数：user_id (其他参数)
	 */
	public String my_address_add(String token, String user_id, String province_name,
			String city_name, String area_name, String name, String address,
			String postal_code, String tel) {
		try {
			String url = WKApplication.BASE_URL + "my_address_add";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("province_name", province_name));
			params.add(new BasicNameValuePair("city_name", city_name));
			params.add(new BasicNameValuePair("area_name", area_name));
			params.add(new BasicNameValuePair("name", name));
			params.add(new BasicNameValuePair("address", address));
			params.add(new BasicNameValuePair("postal_code", postal_code));
			params.add(new BasicNameValuePair("tel", tel));
			
			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 修改地址 接口：rewrite_my_address * 参数：user_id (其他参数)
	 */
	public String rewrite_my_address(String token, String address_id, String user_id,
			String province_name, String city_name, String area_name,
			String name, String address, String postal_code, String tel) {
		try {
			String url = WKApplication.BASE_URL + "rewrite_my_address";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("address_id", address_id));
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("province_name", province_name));
			params.add(new BasicNameValuePair("city_name", city_name));
			params.add(new BasicNameValuePair("area_name", area_name));
			params.add(new BasicNameValuePair("name", name));
			params.add(new BasicNameValuePair("address", address));
			params.add(new BasicNameValuePair("postal_code", postal_code));
			params.add(new BasicNameValuePair("tel", tel));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 删除地址 接口：my_address_del * 参数：user_id, address_id
	 */
	public String my_address_del(String token, String user_id, String address_id) {
		try {
			String url = WKApplication.BASE_URL + "my_address_del";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("address_id", address_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 养老金／诚信币列表
	 */
	public String get_yc_list(String token, String action, String user_id, int start,
			int count, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + action;
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 获取城市列表
	 */
	public String getCityList(boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "get_city_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 获取个人兑换列表
	 */
	public String getMyExcList(String token, String user_id, int start, int count,
			boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "my_exc_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("user_id", user_id));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 获取个人兑换订单详情
	 */
	public String getOrderInfo(String token, String user_id, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "order_info";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("order_id", user_id));

			params.add(new BasicNameValuePair("token", token));
			params.add(new BasicNameValuePair("request_id", String.valueOf(System.currentTimeMillis())));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 反馈
	 */
	public String feed_back(String user_id, String param, String version,
			String content, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "feed_back";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("uid", user_id));
			params.add(new BasicNameValuePair("param", String.valueOf(param)));
			params.add(new BasicNameValuePair("version", String
					.valueOf(version)));
			params.add(new BasicNameValuePair("content", String
					.valueOf(content)));// 必填
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 注册
	 */
	public String user_register(String user_name, String idCardNo,
			String mobileNo, String address, String password,
			String bankCardNo, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "user_register";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("type", "1"));
			params.add(new BasicNameValuePair("userName", user_name));
			params.add(new BasicNameValuePair("idCardNo", idCardNo));
			params.add(new BasicNameValuePair("mobileNo", mobileNo));// 必填
			params.add(new BasicNameValuePair("address", address));// 必填
			params.add(new BasicNameValuePair("password", password));// 必填
			params.add(new BasicNameValuePair("bankCardNo", bankCardNo));// 必填
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 注册短信获取验证码 接口：request_register_code * 参数：phone
	 */
	public String request_register_code(String phone, String code) {
		try {
			String url = WKApplication.BASE_URL + "request_register_code";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("phone", phone));
			params.add(new BasicNameValuePair("code", ""));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 获取商店列表 接口：store_list * 参数：city_id(城市ID,改成city_name), coordinate_x,
	 * coordinate_y, start, count
	 */
	public String adviser_list(String city_name, double coordinate_x,
			double coordinate_y, int start, int count, boolean... readLocal) {
		try {
			String url = WKApplication.BASE_URL + "adviser_list";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("city_name", city_name));
			params.add(new BasicNameValuePair("coordinate_x", coordinate_x + ""));
			params.add(new BasicNameValuePair("coordinate_y", coordinate_y + ""));
			params.add(new BasicNameValuePair("start", String.valueOf(start)));
			params.add(new BasicNameValuePair("count", String.valueOf(count)));
			return getConnRequest(getParams(params), url, readLocal);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 注册短信获取验证码 接口：request_register_code * 参数：phone
	 */
	public String adviser_info(String adviser_id) {
		try {
			String url = WKApplication.BASE_URL + "adviser_info";
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("adviser_id", adviser_id));
			return getConnRequest(getParams(params), url);
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}
}
